
require "modules/application"
require "modules/inputmethod"
require "modules/clipboard"
require "modules/windows"
function reloadConfig(files)
    local doReload = false
    for _,file in pairs(files) do
      if file:sub(-4) == ".lua" then
        doReload = true
      end
    end
    if doReload then
      hs.reload()
      hs.alert.show('Config Reloaded')
    end
end

hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/Modules/", reloadConfig):start()

-- Well, sometimes auto-reload is not working, you know u.u
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "n", function()
    hs.reload()
end)